<?php

namespace App\Http\Controllers\Guest;

use App\Http\Controllers\Controller;
use App\Model\Blog\Categories;
use App\Model\Blog\Post;


class BlogController extends Controller
{
    public function __construct()
    {
        $this->middleware('comingsoon');
    }

    public function index()
    {
        $data = Post::paginate(5);
        $categories = Categories::all();

        return view('blog.index', compact('data', 'categories'));
    }

    public function category($id)
    {
        $data = Categories::find($id);
        $categories = Categories::all();
        return view('blog.category', compact('data', 'categories'));
    }

    public function post($id)
    {
        $item = Post::find($id);
        $categories = Categories::all();
        return view('blog.post', compact('item', 'categories'));
    }
}
